package com.aboo.dao.impl;

import java.util.List;

import com.aboo.dao.BaseSqlMapDao;
import com.aboo.dao.SysAdminLogDao;
import com.aboo.po.Page;
import com.aboo.po.SysAdminLogPO;
import com.aboo.pub.constant.Constant;

public class SysAdminLogDaoImpl extends BaseSqlMapDao implements SysAdminLogDao {

	public Integer save(SysAdminLogPO po) throws Exception {
		return (Integer) getSmcTemplate().insert("SysAdminLog.insertSysAdminLog", po);
	}

	public void delete(Integer id) throws Exception {
		SysAdminLogPO tmp = new SysAdminLogPO();
		tmp.setId(id);
		tmp.setInUse(Constant.INUSE_NO);
		getSmcTemplate().update("SysAdminLog.updateSysAdminLog", tmp);
	}

	public SysAdminLogPO find(SysAdminLogPO po) throws Exception {
		return (SysAdminLogPO) getSmcTemplate().queryForObject("SysAdminLog.selectSysAdminLogList", po);
	}

	public Integer findCount(SysAdminLogPO po) throws Exception {
		return (Integer) getSmcTemplate().queryForObject("SysAdminLog.selectSysAdminLogCount", po);
	}

	public List<SysAdminLogPO> findList(SysAdminLogPO po, Page page)
			throws Exception {
		if (page != null) {
			po.setBeginIndex(page.getBeginRecordIndex());
			po.setEndIndex(page.getEndRecordIndex());
		}
		po.addSort("ID", Constant.SORT_ASC);
		return getSmcTemplate().queryForList("SysAdminLog.selectSysAdminLogList", po);
	}

	public void update(SysAdminLogPO po) throws Exception {
		getSmcTemplate().update("SysAdminLog.updateSysAdminLog", po);
	}

}
